<script>
	import Header from "@/components/Header.vue"
	import Modal from "@/components/Modal.vue"
	export default {
		components: {
			Modal,
			Header
		},
		data() {
			return {
				modalShow: false,
				title: "我的钱包",
				info:{},
				money:0,
				is_tx:2
			}
		},
		onLoad(options) {
			var that = this
			 
			uni.request({
				url: getApp().globalData.host + '/api/My/getMyInfo',
				header: {
					memberid: uni.getStorageSync('member_id'),
					membertoken: uni.getStorageSync('member_token'),
				},
				success: (rr) => {
					uni.setStorageSync('info', rr.data.data)
					that.info = rr.data.data
					
					uni.request({
						url: getApp().globalData.host + '/api/Fund/getFundInfo',
						header: {
							memberid: uni.getStorageSync('member_id'),
							membertoken: uni.getStorageSync('member_token'),
						},
						success: (rrr) => {
							uni.setStorageSync('getFundInfo', rrr.data.data)
							that.money = rrr.data.data.money
							console.log(that.money)
						},
					})
					
					
				},
			})
			
			
			
		},
		onShow() {
			var that = this
			that.modalShow=false
			uni.request({
				url: getApp().globalData.host + '/api/My/getMyInfo',
				header: {
					memberid: uni.getStorageSync('member_id'),
					membertoken: uni.getStorageSync('member_token'),
				},
				success: (rr) => {
					uni.setStorageSync('info', rr.data.data)
					that.info = rr.data.data
					
					uni.request({
						url: getApp().globalData.host + '/api/Fund/getFundInfo',
						header: {
							memberid: uni.getStorageSync('member_id'),
							membertoken: uni.getStorageSync('member_token'),
						},
						success: (rrr) => {
							uni.setStorageSync('getFundInfo', rrr.data.data)
							that.money = rrr.data.data.money
						},
					})
					
					
				},
			})
			
			uni.request({
				url: getApp().globalData.host + '/api/My/getIsRead',
				header: {
					memberid: uni.getStorageSync('member_id'),
					membertoken: uni.getStorageSync('member_token'),
				},
				success: (res) => {
					that.is_tx = res.data.data.is_tx
				},
			})
		},
		methods: {
			tixian(){
				if(this.info.me_is_real==0){
					this.modalShow=true
				}else{
					uni.navigateTo({
						url:'/pages/my/wallet/withDrawal'
					})
				}
			}
		}
	}
</script>
<template>
	<view class="custom-bg">
		<Modal v-if="modalShow" :show-cancel="true" confirm-text="去认证"
		 @cancel="()=>{
			 modalShow=false
		 }"
		 @confirm="()=>{
			go('/pages/my/auth/auth')
		}">
			<div class="fz28 center my-40 text-gray-a4">请您先完成实名认证，才能提现</div>
		</Modal>
		<Header :title="title" />

		<div class="p-30">
			<div class="bg-primary-2 rounded-20  px-30 py-50 text-white relative">
				<div class="fz30">茶水费</div>
				<div class="fz40 mt-16">{{money}}</div>
				<div v-if="is_tx==1" class="bg-white text-purple absolute px-30 py-10 rounded-30 absolute"
					style="right: 40rpx; bottom: 40rpx;" @click="tixian()">提现</div>
			</div>
		</div>

		<div class="between h-130 bg-white px-30" @click="go('/pages/my/wallet/log?type=1')">
			<div class="fz26 text-gray-29">支出记录</div>
			<image src="/static/my/right.png" mode="widthFix" class="w-20"></image>
		</div>
		<div class="line"></div>
		<div class="between h-130 bg-white px-30" @click="go('/pages/my/wallet/log?type=2')">
			<div class="fz26 text-gray-29">收入记录</div>
			<image src="/static/my/right.png" mode="widthFix" class="w-20"></image>
		</div>
		<div class="line"></div>
		<div class="between h-130 bg-white px-30" @click="go('/pages/my/wallet/log?type=3')">
			<div class="fz26 text-gray-29">提现记录</div>
			<image src="/static/my/right.png" mode="widthFix" class="w-20"></image>
		</div>


	</view>


</template>



<style>
	.custom-bg {
		min-height: 100%;
	}

	.avatar-group {
		position: relative;
	}

	page {
		height: 100%;
		background-color: #F8F8F8;
	}
</style>